﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace ReservationModule
{
    public partial class ViewAllStaff : System.Web.UI.Page
    {
        static string ConnectionString = "Data Source=localhost;Initial Catalog=hmsdb;Persist Security Info=True;User ID=sa;Password=imsa";
        SqlConnection objconnection = new SqlConnection(ConnectionString);
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["Login"] = Session["Login"];
            if (Session["Login"] == "false" || Session["Login"] == null)
            {
                Response.Redirect("Reject.aspx");
            }

            if (Session["StaffType"] == "Receptionist")
            {
                Response.Redirect("Reject.aspx");
            }

            string sqlQuery = "select * from STAFF";

            objconnection.Open();
            SqlCommand obj = new SqlCommand(sqlQuery, objconnection);
            SqlDataReader dr = obj.ExecuteReader();
            DataTable dt = new DataTable();
            dt.Load(dr);
            GridView1.DataSource = dt;
            GridView1.DataBind();
            objconnection.Close();
        }

        protected void btnBack_Click(object sender, EventArgs e)
        {
            Response.Redirect("HousekeepingAndStaffMenu.aspx");
        }
    }
}